From 73ed30704e09ac55624cf4d676325551560301dc Mon Sep 17 00:00:00 2001 From: "mafetter@fleming.research" Date: Wed, 23 Mar 2005 12:53:05 +0000 Subject: [PATCH] bitkeeper revision 1.1257 (424166b1-4aA-sSJbmTizuGjdmiSWg) Don't fully populate the shadow for every L1 we map. Only populate the demanded entry in the L1, and then from entry 0 up to the first invalid entry. Signed-off-by: michael.fetterman@cl.cam.ac.uk --- BitKeeper/etc/ignore | 3 +++ xen/arch/x86/shadow.c | 17 +++++++++++++++-- xen/include/asm-x86/shadow.h | 3 +-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index a248c75b8c..6990f1b2aa 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -101,3 +101,6 @@ xen/tools/figlet/figlet xen/xen xen/xen-syms xen/xen.* +tools/misc/cpuperf/cpuperf-perfcntr +tools/misc/cpuperf/cpuperf-xen +tools/misc/xc_shadow diff --git a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c index 8208382334..70fd8a2e9d 100644 --- a/xen/arch/x86/shadow.c +++ b/xen/arch/x86/shadow.c @@ -1427,14 +1427,27 @@ void shadow_map_l1_into_current_l2(unsigned long va) &(shadow_linear_pg_table[l1_linear_offset(va) & ~(L1_PAGETABLE_ENTRIES-1)]); + memset(spl1e, 0, PAGE_SIZE); + + unsigned long sl1e; + int index = l1_table_offset(va); + + l1pte_propagate_from_guest(d, gpl1e[index], &sl1e); + if ( (sl1e & _PAGE_PRESENT) && + !shadow_get_page_from_l1e(mk_l1_pgentry(sl1e), d) ) + sl1e = 0; + spl1e[index] = sl1e; + for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ ) { - unsigned long sl1e; - + if ( i == index ) + continue; l1pte_propagate_from_guest(d, gpl1e[i], &sl1e); if ( (sl1e & _PAGE_PRESENT) && !shadow_get_page_from_l1e(mk_l1_pgentry(sl1e), d) ) sl1e = 0; + if ( sl1e == 0 ) + break; spl1e[i] = sl1e; } } diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index dd4ae21034..4b9d488573 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -609,14 +609,13 @@ static inline int l1pte_read_fault( static inline void l1pte_propagate_from_guest( struct domain *d, unsigned long gpte, unsigned long *spte_p) { - unsigned long pfn = gpte >> PAGE_SHIFT; unsigned long mfn, spte; spte = 0; if ( ((gpte & (_PAGE_PRESENT|_PAGE_ACCESSED) ) == (_PAGE_PRESENT|_PAGE_ACCESSED)) && - VALID_MFN(mfn = __gpfn_to_mfn(d, pfn)) ) + VALID_MFN(mfn = __gpfn_to_mfn(d, gpte >> PAGE_SHIFT)) ) { spte = (mfn << PAGE_SHIFT) | (gpte & ~PAGE_MASK); -- 2.30.2